﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FySystem.Entity.Common
{
    public class IdITO
    {
        public string? id { get; set; }

        public string? tag { get; set; }

        public Guid gid()
        {
            try
            {
                return Guid.Parse(id);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public int iid()
        {
            try
            {
                return int.Parse(id);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public long lid()
        {
            try
            {
                return long.Parse(id);
            }
            catch (Exception)
            {
                throw;
            }
        }
    }

    public static class IdITOExtension
    {
        public static bool IsNull(this IdITO idITO)
        {
            if (idITO == null)
                return true;
            else if (string.IsNullOrWhiteSpace(idITO.id))
                return true;
            else
                return false;
        }
    }
}
